/**
 */
package net.opengis.ows20.impl;

import java.util.Collection;

import net.opengis.ows20.ExceptionReportType;
import net.opengis.ows20.ExceptionType;
import net.opengis.ows20.Ows20Package;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Exception Report Type</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * </p>
 * <ul>
 *   <li>{@link net.opengis.ows20.impl.ExceptionReportTypeImpl#getException <em>Exception</em>}</li>
 *   <li>{@link net.opengis.ows20.impl.ExceptionReportTypeImpl#getLang <em>Lang</em>}</li>
 *   <li>{@link net.opengis.ows20.impl.ExceptionReportTypeImpl#getVersion <em>Version</em>}</li>
 * </ul>
 *
 * @generated
 */
public class ExceptionReportTypeImpl extends EObjectImpl implements ExceptionReportType {
    /**
   * The cached value of the '{@link #getException() <em>Exception</em>}' containment reference list.
   * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
   * @see #getException()
   * @generated
   * @ordered
   */
    protected EList<ExceptionType> exception;

    /**
   * The default value of the '{@link #getLang() <em>Lang</em>}' attribute.
   * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
   * @see #getLang()
   * @generated
   * @ordered
   */
    protected static final String LANG_EDEFAULT = null;

    /**
   * The cached value of the '{@link #getLang() <em>Lang</em>}' attribute.
   * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
   * @see #getLang()
   * @generated
   * @ordered
   */
    protected String lang = LANG_EDEFAULT;

    /**
   * The default value of the '{@link #getVersion() <em>Version</em>}' attribute.
   * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
   * @see #getVersion()
   * @generated
   * @ordered
   */
    protected static final String VERSION_EDEFAULT = null;

    /**
   * The cached value of the '{@link #getVersion() <em>Version</em>}' attribute.
   * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
   * @see #getVersion()
   * @generated
   * @ordered
   */
    protected String version = VERSION_EDEFAULT;

    /**
   * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
   * @generated
   */
    protected ExceptionReportTypeImpl() {
    super();
  }

    /**
   * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
   * @generated
   */
    @Override
    protected EClass eStaticClass() {
    return Ows20Package.Literals.EXCEPTION_REPORT_TYPE;
  }

    /**
   * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
   * @generated
   */
    @Override
    public EList<ExceptionType> getException() {
    if (exception == null) {
      exception = new EObjectContainmentEList<>(ExceptionType.class, this, Ows20Package.EXCEPTION_REPORT_TYPE__EXCEPTION);
    }
    return exception;
  }

    /**
   * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
   * @generated
   */
    @Override
    public String getLang() {
    return lang;
  }

    /**
   * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
   * @generated
   */
    @Override
    public void setLang(String newLang) {
    String oldLang = lang;
    lang = newLang;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, Ows20Package.EXCEPTION_REPORT_TYPE__LANG, oldLang, lang));
  }

    /**
   * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
   * @generated
   */
    @Override
    public String getVersion() {
    return version;
  }

    /**
   * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
   * @generated
   */
    @Override
    public void setVersion(String newVersion) {
    String oldVersion = version;
    version = newVersion;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, Ows20Package.EXCEPTION_REPORT_TYPE__VERSION, oldVersion, version));
  }

    /**
   * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
   * @generated
   */
    @Override
    public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
    switch (featureID) {
      case Ows20Package.EXCEPTION_REPORT_TYPE__EXCEPTION:
        return ((InternalEList<?>)getException()).basicRemove(otherEnd, msgs);
    }
    return super.eInverseRemove(otherEnd, featureID, msgs);
  }

    /**
   * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
   * @generated
   */
    @Override
    public Object eGet(int featureID, boolean resolve, boolean coreType) {
    switch (featureID) {
      case Ows20Package.EXCEPTION_REPORT_TYPE__EXCEPTION:
        return getException();
      case Ows20Package.EXCEPTION_REPORT_TYPE__LANG:
        return getLang();
      case Ows20Package.EXCEPTION_REPORT_TYPE__VERSION:
        return getVersion();
    }
    return super.eGet(featureID, resolve, coreType);
  }

    /**
   * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
   * @generated
   */
    @SuppressWarnings("unchecked")
    @Override
    public void eSet(int featureID, Object newValue) {
    switch (featureID) {
      case Ows20Package.EXCEPTION_REPORT_TYPE__EXCEPTION:
        getException().clear();
        getException().addAll((Collection<? extends ExceptionType>)newValue);
        return;
      case Ows20Package.EXCEPTION_REPORT_TYPE__LANG:
        setLang((String)newValue);
        return;
      case Ows20Package.EXCEPTION_REPORT_TYPE__VERSION:
        setVersion((String)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

    /**
   * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
   * @generated
   */
    @Override
    public void eUnset(int featureID) {
    switch (featureID) {
      case Ows20Package.EXCEPTION_REPORT_TYPE__EXCEPTION:
        getException().clear();
        return;
      case Ows20Package.EXCEPTION_REPORT_TYPE__LANG:
        setLang(LANG_EDEFAULT);
        return;
      case Ows20Package.EXCEPTION_REPORT_TYPE__VERSION:
        setVersion(VERSION_EDEFAULT);
        return;
    }
    super.eUnset(featureID);
  }

    /**
   * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
   * @generated
   */
    @Override
    public boolean eIsSet(int featureID) {
    switch (featureID) {
      case Ows20Package.EXCEPTION_REPORT_TYPE__EXCEPTION:
        return exception != null && !exception.isEmpty();
      case Ows20Package.EXCEPTION_REPORT_TYPE__LANG:
        return LANG_EDEFAULT == null ? lang != null : !LANG_EDEFAULT.equals(lang);
      case Ows20Package.EXCEPTION_REPORT_TYPE__VERSION:
        return VERSION_EDEFAULT == null ? version != null : !VERSION_EDEFAULT.equals(version);
    }
    return super.eIsSet(featureID);
  }

    /**
   * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
   * @generated
   */
    @Override
    public String toString() {
    if (eIsProxy()) return super.toString();

    StringBuilder result = new StringBuilder(super.toString());
    result.append(" (lang: ");
    result.append(lang);
    result.append(", version: ");
    result.append(version);
    result.append(')');
    return result.toString();
  }

} //ExceptionReportTypeImpl
